/*----------------------------------------------------------------------------------------------
* This source file is part of Kinect-Fighter (A Fighting Game controlled 
*	by Kinect and Keyboard.)
*
* Copyright (c) 2012-2012 Hu Guozhu
*
* Usage of this program is free for non-commercial use and licensed under the
* the terms of the MIT License.
*
*-------------------------------------------------------------------------------------------------*/

#include "stdafx.h"
#include "OgreBulletDynamicsWorld.h"
#include "KFPhysicsEngine.h"

using namespace Ogre;

namespace KinectFighter
{

	KFPhysicsEngine::KFPhysicsEngine(Ogre::SceneManager *manager, const Ogre::AxisAlignedBox &bounds)
	{
		mSceneManager	= manager;
		mBounds->setMinimum(bounds.getMinimum());
		mBounds->setMaximum(bounds.getMaximum());
		mDynamicsWorld	= NULL;	
	}

	void KFPhysicsEngine::InitWorld()
	{
		mDynamicsWorld = new OgreBulletDynamics::DynamicsWorld(mSceneManager, *mBounds, Ogre::Vector3(0, -10, 0), true, true, 100000);

		// add Debug info display tool
		OgreBulletCollisions::DebugDrawer *debugDrawer = new OgreBulletCollisions::DebugDrawer();
		mDynamicsWorld->setDebugDrawer(debugDrawer);
		SceneNode *node = mSceneManager->getRootSceneNode()->createChildSceneNode("debugDrawer", Ogre::Vector3::ZERO);
		node->attachObject (static_cast <SimpleRenderable *> (debugDrawer));	
	}

	


}

